//
//  ViewController.swift
//  CHCycleview
//
//  Created by cyptt on 2022/5/17.
//

import UIKit
import SnapKit
class ViewController: UIViewController, SDCycleScrollViewDelegate, ConstraintRelatableTarget {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        CHCycleview.init().test()
        
//        let page:UIPageControl = UIPageControl.init(frame: CGRect.init(x: 0, y: 100, width: 400, height: 200))
//        self.view.addSubview(page)
//        page.backgroundColor = UIColor.gray
//        page.pageIndicatorTintColor = UIColor.red
//        page.currentPageIndicatorTintColor = UIColor.yellow
//        page.numberOfPages = 3
//
//        page.currentPage = 1
        let  images = ["https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg",
                       "https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg",
                       ""]
        let titles = ["新建交流QQ群：185534916 ",
                       "disableScrollGesture可以设置禁止拖动",
                       "感谢您的支持，如果下载的",
                       "如果代码在使用过程中出现问题",
                       "您可以发邮件到gsdios@126.com"
                       ];
        let w = self.view.bounds.size.width

        let cycleView:SDCycleScrollView = SDCycleScrollView(frame: CGRect.init(x: 0, y: 100, width: self.view.frame.size.width, height: 200), imageURLStringsGroup: images)


        self.view.addSubview(cycleView)
        
        
        let placeImage:UIImage? = UIImage.init(named: "banner_icon")
        
//        let chcycleView:CHCycleScrollView = CHCycleScrollView(frame: CGRect.init(x: 0, y: 400, width: self.view.frame.size.width, height: 200),imageURLStringsGroup: images)
//        chcycleView.backgroundColor = UIColor.red
//        self.view.addSubview(chcycleView)
//        let  cycleView2:SDCycleScrollView = SDCycleScrollView(frame:CGRect.zero, delegate: self, placeholderImage: placeImage!)
//        cycleView2.frame =  CGRect.init(x: 0, y: 400, width: self.view.frame.size.width, height: 200)
    
        
        self.view.addSubview(self.cycleView2)
        
        self.cycleView2.snp.makeConstraints { make in
            make.width.equalTo(self.view.frame.size.width - 20)
            make.height.equalTo(120)
            make.left.equalTo(10)
            make.top.equalTo(self.view).offset(400)
        }
        
        self.cycleView2.imageURLStringsGroup = images
    }

    lazy var cycleView2 = {()-> SDCycleScrollView in
        let placeImage:UIImage? = UIImage.init(named: "banner_icon")
        let cycleView =  SDCycleScrollView(frame:CGRect.zero, delegate: self, placeholderImage: placeImage!)

        return cycleView!;
    }()
    
    
    func cycleScrollView(_ cycleScrollView: SDCycleScrollView!, didScrollTo index: Int) {
        
    }

}



